<template>
  <div class="zixun" v-if="indexInformationData">
    <div>
      <img src="../assets/image/zixun.png" alt="">
    </div>
    <div class="zixun_content">
      <div @click="goInformation(indexInformationData.id)">
        <div>
          <span class="title">
          {{indexInformationData.createtime_friend}}
          </span>
          <span class="shuxian">|</span>
          <span>{{indexInformationData.title | dropStr(10)}}</span>
        </div>
        <div class="right">
          <span class="iconfont icon-icon--"></span>
        </div>
      </div>
    </div>

  </div>
</template>

<script>
  import {indexInformation} from '../axios/api';
  import {getCityName} from '../assets/js/cache';

  export default {
    name: 'BuildingInformation',
    data() {
      return {
        indexInformationData: {}
      }
    },
    created() {
      this.getIndexInformation();
    },
    methods: {
      //获取资讯
      getIndexInformation() {
        indexInformation(getCityName().CODE).then(res => {
          this.indexInformationData = res.data[0];
        }).catch(err => {
          console.log(err);
        })
      },
      //跳转至资讯详情
      goInformation(id) {
        this.$router.push('/InformationDetails/' + id);
      }
    }
  }
</script>

<style scoped>
  .zixun {
    /*margin-top: 10px;*/
    padding: 10px 10px 20px 10px;
    background-color: #fff;
    display: flex;
    font-size: 0.8rem;
  }

  .zixun > div {
    height: 20px;
    line-height: 20px;
  }
.zixun_content{
  flex: 1;
  padding-right: 10px;
}
  .zixun_content > div {
    flex: 1;
    display: flex;
    justify-content: space-between;
    margin-left: 10px;
    width: 100%;
  }
/*.zixun_content .right{*/
  /*text-align: right;*/
  /*flex: 1;*/
/*}*/
  .zixun img {
    height: 20px;
  }

  .zixun .shuxian {
    font-size: 0.6rem;
    line-height: 20px;
  }
</style>
